package com.csii.adhoc.util;


public class StringUtils {
    /**
     * 判断是否为空
     *
     * @param s
     * @return
     */
    public static boolean isEmpty(String s) {
        return s == null || "".equals(s.trim());
    }

    /**
     * 驼峰转下划线  例：  tSysParam -> T_SYS_PARAM
     * @param str 输入
     * @return 返回下划线格式字符串
     */
    public static String humpToUnderscore(String str) {
        if (str == null || str.length() == 0) {
            return "";
        }
        char[] chars = str.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char c : chars) {
            if (c >= 'A' && c <= 'Z') {
                sb.append("_");
            }
            sb.append(c);
        }
        return sb.toString().toUpperCase();
    }
}
